<template>
    <div class="box">
        我是子组件2
        <el-button @click="changeHello">点击触发emits</el-button>
    </div>
</template>
<script setup>
 import { defineEmits} from 'vue'
    let emits = defineEmits(['hello'])
    let changeHello  = () => {
        emits('hello')
    }

    let getData  = {
        page:1,
        pageSize:10,
        name:1,
    }
    let  p = Object.entries(getData).filter(e=>e[1]).map(e=> `${e[0]}=${e[1]}`).join("&")
    console.log(p)


    let arr1 = [2,3,5,6,8,9,10,13,22]
    // let getNumIndex = (targetArr,targetNum,low,high) => {
    //     let index = -1
    //     if(targetNum === targetArr[low]){
    //         index =  low
    //     }
    //     if(targetNum === targetArr[high]){
    //         index =  high
    //     }
    //     let mid = Math.ceil((low + high) / 2)
    //     if(targetNum === targetArr[mid]){
    //         index = mid
    //     }
    //     if(targetNum > targetArr[mid]){
    //       return   getNumIndex(targetArr,targetNum,mid, high)
    //     }
    //     if(targetNum < targetArr[mid]){
    //       return   getNumIndex(targetArr,targetNum,0, mid)
    //     }
    //     return index
    // }
    let getNumIndex = (targetArr,targetNum,low,high) => {
        let index = -1
        let mid = Math.ceil((low + high) / 2)
        while(low <= high){
            if(targetNum === targetArr[mid]){
                return mid
            }else if((targetNum === targetArr[mid]){
                
            }
        }
        
      

    }
  console.log(getNumIndex(arr1,22,0,arr1.length-1))  

</script>
<style scoped lang="scss">
$colors:pink;
.box {
    color: $colors;
}
.box :deep(.el-button) {

    color:$colors;

}
</style>